<template>
  <div class="app-container">
    <div class="header">
      <el-card>
        <el-tabs v-model="activeName">
          <el-tab-pane label="个人信息" name="first">
            <div class="myapply">
              <span class="picCircle">
                <img src="@/assets/common/img.jpeg" class="img">
              </span>
              <span class="rightContent">
                <el-form :model="userInfo" label-width="80px">
                  <el-form-item label="姓名">
                    <el-input v-model="userInfo.username" />
                  </el-form-item>
                  <el-form-item label="手机号">
                    <el-input v-model="userInfo.mobile" />
                  </el-form-item>
                  <el-form-item label="性别">
                    <el-select v-model="userInfo.sex" placeholder="请选择">
                      <el-option label="男" value="男" />
                      <el-option label="女" value="女" />
                    </el-select>
                  </el-form-item>
                  <el-form-item label="出生日期">
                    <el-date-picker
                      v-model="userInfo.birthday"
                      type="date"
                      placeholder="选择日期"
                    />
                  </el-form-item>
                  <el-form-item>
                    <el-button type="primary" @click="onSubmit">保存</el-button>
                    <el-button @click="btnCancle">取消</el-button>
                  </el-form-item>
                </el-form>
              </span>
            </div>
          </el-tab-pane>
        </el-tabs>
      </el-card>
    </div>
  </div>
</template>

<script>
import { getPersonalDetail, updatePersonal } from '@/api/employees'
// import { updateUser } from '@/api/user'
export default {
  data() {
    return {
      activeName: 'first',
      userInfo: {}
    }
  },
  mounted() {
    console.log(this.userInfo)
    this.getPersonalDetail()
  },
  methods: {
    async onSubmit() {
      await updatePersonal(this.userInfo)
      //   await updateUser(this.userInfo)
      this.$message.success('保存成功')
    },
    async getPersonalDetail() {
      this.userInfo = await getPersonalDetail()
      console.log(this.userInfo)
    },
    btnCancle() {
      this.$router.back(-1)
    }
  }
}
</script>

<style lang="scss" scoped>
.myapply{
    display: flex;
    font-size: 14px;
    margin-bottom: 20px;
    .img{
      width: 100px;
      // height: 80px;
    }
    .rightContent{
      margin-left: 20px;
    }

  }
</style>
